package com.yunmang.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yunmang.R;
import com.yunmang.entity.MyItemInfoBean;
import com.yunmang.utils.ViewHolderUtils;

import java.util.List;

/**
 * Created by Administrator on 2017/5/23.
 */
public class BlackBordAdapter extends BaseAdapter{
    private List<MyItemInfoBean> list;
    private Context context;
    public BlackBordAdapter(Context context,List<MyItemInfoBean> list){
        this.context=context;
        this.list=list;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup) {
        MyItemInfoBean myItemInfoBean = list.get(i);
        if(convertView==null)
            convertView=View.inflate(context, R.layout.item_blackbord,null);
        TextView title = ViewHolderUtils.get(convertView, R.id.tv_title);
        TextView data = ViewHolderUtils.get(convertView, R.id.tv_data);
        title.setText(myItemInfoBean.getTitle());
        if(myItemInfoBean.getDetail().contains("%")){
            data.setTextColor(context.getResources().getColor(R.color.blackred));
        }else{
            data.setTextColor(context.getResources().getColor(R.color.theme_bg));
        }
        data.setText(myItemInfoBean.getDetail());
        return convertView;
    }
}
